home *** CD-ROM | disk | FTP | other *** search
- /*********************************************************************
- * *
- * HodgePodge *
- * 'C' version *
- * *
- * July 17, 1987 vB2.0 *
- * *
- * (c) Copyright 1986, 1987 Apple Computer, Inc. *
- * *
- * All rights reserved. *
- * *
- * This program and its derivatives are licensed only for *
- * use on Apple computers. *
- * *
- * Works based on this program must contain and *
- * conspicuously display this notice. *
- * *
- * This software is provided for your evaluation and to *
- * assist you in developing software for the Apple IIGS *
- * computer. *
- * *
- * This is not a distribution license. Distribution of *
- * this and other Apple software requires a separate *
- * license. Contact the Software Licensing Department of *
- * Apple Computer, Inc. for details. *
- * *
- * DISCLAIMER OF WARRANTY *
- * *
- * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT *
- * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, *
- * WITH RESPECT TO ITS MERCHANTABILITY OR ITS FITNESS *
- * FOR ANY PARTICULAR PURPOSE. THE ENTIRE RISK AS TO *
- * THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH *
- * YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU (AND *
- * NOT APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE) *
- * ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, *
- * REPAIR OR CORRECTION. *
- * *
- * Apple does not warrant that the functions *
- * contained in the Software will meet your requirements *
- * or that the operation of the Software will be *
- * uninterrupted or error free or that defects in the *
- * Software will be corrected. *
- * *
- * SOME STATES DO NOT ALLOW THE EXCLUSION *
- * OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY *
- * NOT APPLY TO YOU. THIS WARRANTY GIVES YOU SPECIFIC *
- * LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS *
- * WHICH VARY FROM STATE TO STATE. *
- * *
- *********************************************************************/
-
- #include <types.h>
- #include <prodos.h>
- #include <misctool.h>
- #include <quickdraw.h>
- #include <qdaux.h>
- #include <window.h>
- #include <memory.h>
- #include <dialog.h>
- #include <menu.h>
- #include <control.h>
- #include <desk.h>
- #include <event.h>
- #include <lineedit.h>
- #include <misctool.h>
- #include <locator.h>
- #include <stdfile.h>
- #include <print.h>
- #include <font.h>
- #include <intmath.h>
- #include <list.h>
- #include <scrap.h>
- #include "hp.h"
-
- extern int _toolErr;
-
- boolean ToolsFound = FALSE, /* Do we have tools ? */
- AllOk = FALSE,
- PManagerFound = TRUE; /* assume the PM is there */
-
- int MyID;
- int ThisMode = 0x80; /* init mode = 640 */
-
- int ToolTable [] = {14, /* Number of items */
- 4, 0x100, /* QuickDraw II */
- 5, 0x100, /* Desk Manager */
- 6, 0x100, /* Event Manager */
- 14, 0x100, /* Window Manager */
- 15, 0x100, /* Menu Manager */
- 16, 0x100, /* Control Manager */
- 18, 0x100, /* QuickDraw Auxiliary */
- 19, 0x000, /* Print Manager */
- 20, 0x100, /* Line Edit */
- 21, 0x100, /* Dialog Manager */
- 22, 0x100, /* Scrap Manager */
- 23, 0x100, /* Standard File */
- 27, 0x100, /* Font Manager */
- 28, 0x000}; /* List Manager */
-
-
-
- char **y,*z;
-
-
- GrafPortPtr OrigPort;
-
-
-
-
-
- /* This is the routine that will do the initialization of tools, will allocate
- memory and all related tasks
- */
-
-
-
- boolean StartUpTools ()
-
- {
- static char SysToolsDirStr [] = "\p*/SYSTEM/TOOLS";
- static FileRec ParamBlock = { SysToolsDirStr , NULL };
-
- TLStartUp (); /* for calling tools */
- CheckToolError (1);
-
- MyID = MMStartUp(); /* ID for all transactions */
- CheckToolError (2);
-
- MTStartUp(); /* Misc. Tools */
- CheckToolError (3); /* Make sure all is OK */
-
- y = NewHandle (0xA00L, /* Ten pages */
- MyID, /* put it to my name */
- attrBank +
- attrPage +
- attrFixed +
- attrLocked,
- 0L); /* don't care */
- CheckToolError (4);
-
- z = *y; /* deref handle */
-
- QDStartUp ((int) z,ThisMode,MAXSCAN,MyID);
- CheckToolError (5);
-
- EMStartUp((int) z + 0x300,20,0,640,0,200,MyID); /* Event Manager */
- CheckToolError (6);
-
- MoveTo (20,20);
- SetBackColor (0);
- SetForeColor (15);
- DrawString ("\pOne Moment Please... ");
- ShowCursor ();
-
- TryAgain:
- GET_FILE_INFO (&ParamBlock);
- if (_toolErr)
- if (MountBootDisk () == 1)
- goto TryAgain;
- else
- return (false); /* Exit function unsuccessfully */
-
- LoadTools (ToolTable); /* Now it's ok to do this */
- CheckToolError (7);
-
- QDAuxStartUp ();
- CheckToolError (8);
-
- WaitCursor (); /* Show wristwatch cursor */
-
- WindStartUp (MyID);
- CheckToolError (9);
-
- RefreshDesktop (NULL);
-
- CtlStartUp (MyID,(int) z + 0x400);
- CheckToolError (10);
-
- LEStartUp (MyID, (int) z + 0x500);
- CheckToolError (11);
-
- DialogStartUp (MyID);
- CheckToolError (12);
-
- MenuStartUp (MyID, (int) z + 0x600);
- CheckToolError (13);
-
- DeskStartUp(); /* All we need is init'ed now */
- CheckToolError (14);
-
- ShowPleaseWait ();
-
- SFStartUp(MyID, (int) z + 0x700);
- CheckToolError (15);
- SFAllCaps (true);
-
- FMStartUp(MyID, (int) z + 0x800); /* the watch cursor is up */
- CheckToolError (16); /* while we count the fonts */
-
- ListStartup (); /* >!< Note, not ListStartUp with upper case "U"! */
- CheckToolError (17);
-
- PMStartUp (MyID, (int) z + 0x900);
- CheckToolError (18);
-
- ScrapStartUp ();
- CheckToolError (19);
-
- HidePleaseWait (); /* Remove dialog box */
- InitCursor (); /* Show arrow cursor */
-
- return (true); /* Exit function successfully */
- }
-
-
-
-
-
- ShutDownTools ()
-
- {
- DeskShutDown ();
-
- if (WindStatus () != 0)
- HideAllWindows ();
-
- ListShutDown ();
- FMShutDown ();
- ScrapShutDown ();
- PMShutDown ();
- SFShutDown ();
- MenuShutDown ();
- DialogShutDown ();
- LEShutDown ();
- CtlShutDown ();
- WindShutDown ();
- EMShutDown ();
-
- if (QDStatus () != 0)
- GrafOff ();
-
- QDShutDown ();
- MTShutDown ();
-
- if (MMStatus () != 0)
- {
- DisposeHandle (y);
- MMShutDown (MyID);
- }
- TLShutDown ();
- }
-
-
-
-
-
- /* MAIN program routine */
-
- main ()
- {
- if (StartUpTools ()) /* Try to initialize tools */
- {
- SetUpMenus ();
- MainEvent ();
- }
- ShutDownTools (); /* Shutdown tools even if didn't run */
- }
-